﻿using PlutoStudio.Net.Tcp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace PlutoStudio.Net.Client
{
    public class NetContext<T> : PlutoStudio.Net.Processors.NetContext where T:INetClient,new()
    {

        internal NetContext(T client)
            : base(client)
        {

        }

        public NetContext()
            : this(new T())
        {
            this.Client.Connected += Client_Connected;
        }

        void Client_Connected(object sender, EventArgs e)
        {
            base.BeginProcess();
        }

        protected override string ProcessorConfigName
        {
            get { return "Processor.config"; }
        }

        public void Open()
        {
            Client.Connect();
        }

        public void Open(IPEndPoint endPoint)
        {
            Client.Connect(endPoint);
        }
    }
}
